Rank the globular clusters in the table by the ease of separating the cluster members from the field stars, using the Gaia DR3.

Here is the first example: NGC 6544. The database of each globular cluster can be explored here.

Variables used: source_id, ra, dec, parallax, pmra, pmdec , bp_rp, mh_gspphot, radial_velocity, phot_g_mean_mag.

ngc_6544 <- read.csv("1657065339571O-result.csv")
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6     ✔ purrr   0.3.4
## ✔ tibble  3.1.7     ✔ dplyr   1.0.9
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(readr)
library(ggplot2)
library(ggpubr)

Summary Statistics

summary(ngc_6544)
##    source_id               ra             dec            parallax      
##  Min.   :4.066e+18   Min.   :271.8   Min.   :-25.03   Min.   :-5.8994  
##  1st Qu.:4.066e+18   1st Qu.:271.8   1st Qu.:-25.02   1st Qu.: 0.0246  
##  Median :4.066e+18   Median :271.8   Median :-25.01   Median : 0.3166  
##  Mean   :4.066e+18   Mean   :271.8   Mean   :-25.01   Mean   : 0.2974  
##  3rd Qu.:4.066e+18   3rd Qu.:271.8   3rd Qu.:-25.01   3rd Qu.: 0.5426  
##  Max.   :4.066e+18   Max.   :271.9   Max.   :-24.98   Max.   : 5.6389  
##                                                       NA's   :884      
##       pmra             pmdec              ruwe         phot_g_mean_mag
##  Min.   :-11.516   Min.   :-26.763   Min.   : 0.6191   Min.   :11.30  
##  1st Qu.: -3.111   1st Qu.:-18.901   1st Qu.: 1.0156   1st Qu.:18.01  
##  Median : -2.288   Median :-18.220   Median : 1.1075   Median :18.66  
##  Mean   : -2.270   Mean   :-14.553   Mean   : 1.3995   Mean   :18.49  
##  3rd Qu.: -1.480   3rd Qu.: -8.008   3rd Qu.: 1.3960   3rd Qu.:19.29  
##  Max.   : 13.098   Max.   :  2.831   Max.   :10.1384   Max.   :20.46  
##  NA's   :884       NA's   :884       NA's   :884       NA's   :6      
##      bp_rp        radial_velocity   phot_variable_flag non_single_star
##  Min.   :0.3908   Min.   :-39.574   Length:2000        Min.   :0      
##  1st Qu.:1.7304   1st Qu.:-37.722   Class :character   1st Qu.:0      
##  Median :1.8792   Median :-31.857   Mode  :character   Median :0      
##  Mean   :2.0130   Mean   :-27.274                      Mean   :0      
##  3rd Qu.:2.1718   3rd Qu.:-21.378                      3rd Qu.:0      
##  Max.   :4.5840   Max.   : -2.793                      Max.   :0      
##  NA's   :1191     NA's   :1994                                        
##  has_xp_continuous  has_xp_sampled       has_rvs          has_epoch_photometry
##  Length:2000        Length:2000        Length:2000        Length:2000         
##  Class :character   Class :character   Class :character   Class :character    
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character    
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##  has_epoch_rv       has_mcmc_gspphot   has_mcmc_msc        teff_gspphot  
##  Length:2000        Length:2000        Length:2000        Min.   : 3368  
##  Class :character   Class :character   Class :character   1st Qu.: 4239  
##  Mode  :character   Mode  :character   Mode  :character   Median : 4808  
##                                                           Mean   : 5409  
##                                                           3rd Qu.: 5721  
##                                                           Max.   :15003  
##                                                           NA's   :1809   
##   logg_gspphot      mh_gspphot      distance_gspphot azero_gspphot   
##  Min.   :0.4915   Min.   :-4.0890   Min.   : 338.4   Min.   :0.0056  
##  1st Qu.:3.6568   1st Qu.:-3.3621   1st Qu.: 766.6   1st Qu.:1.1229  
##  Median :4.2829   Median :-1.4194   Median : 958.6   Median :2.0239  
##  Mean   :4.0768   Mean   :-1.8236   Mean   :1408.2   Mean   :2.5044  
##  3rd Qu.:4.6778   3rd Qu.:-0.7768   3rd Qu.:1497.2   3rd Qu.:3.6508  
##  Max.   :5.0177   Max.   : 0.7731   Max.   :9382.5   Max.   :8.8559  
##  NA's   :1809     NA's   :1809      NA's   :1809     NA's   :1809    
##    ag_gspphot     ebpminrp_gspphot
##  Min.   :0.0041   Min.   :0.0022  
##  1st Qu.:0.8386   1st Qu.:0.4668  
##  Median :1.5482   Median :0.8514  
##  Mean   :1.8315   Mean   :1.0174  
##  3rd Qu.:2.7957   3rd Qu.:1.5431  
##  Max.   :5.8228   Max.   :3.3140  
##  NA's   :1809     NA's   :1809

Model 1

  1. Use lm() to regress ra on dec and save the regression as model_1.
model_1 <- lm(ra ~ dec, data = ngc_6544)
  1. Regression results from the first model using summary().

An increase of one unit of dec is associated with an additional -0.22698 unit decrease in ra. This relationship is statistically significant at < 0.001.

summary(model_1)
## 
## Call:
## lm(formula = ra ~ dec, data = ngc_6544)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.032100 -0.014882  0.002286  0.013487  0.039536 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 266.15652    1.09471 243.130  < 2e-16 ***
## dec          -0.22698    0.04376  -5.186 2.36e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01676 on 1998 degrees of freedom
## Multiple R-squared:  0.01328,    Adjusted R-squared:  0.01279 
## F-statistic:  26.9 on 1 and 1998 DF,  p-value: 2.362e-07
  1. Plot results from model_1.
ggplot(data = model_1, aes(x = dec, y = ra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="ra", x="dec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

ngc_6544 %>%
  ggplot(aes(dec,ra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="ra", x="dec")

Model 2

  1. Use lm() to regress pmra on pmdec and save the regression as model_2.
model_2 <- lm(pmra ~ pmdec, data = ngc_6544)
  1. Regression results from the second model using summary().

An increase of one unit of pmdec is associated with an additional 0.058145 unit increase in pmra. This relationship is statistically significant at < 0.001.

summary(model_2)
## 
## Call:
## lm(formula = pmra ~ pmdec, data = ngc_6544)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.1656  -0.6862   0.1299   0.8668  15.2929 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.423818   0.150293  -9.474  < 2e-16 ***
## pmdec        0.058145   0.009366   6.208 7.54e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.115 on 1114 degrees of freedom
##   (884 observations deleted due to missingness)
## Multiple R-squared:  0.03344,    Adjusted R-squared:  0.03257 
## F-statistic: 38.54 on 1 and 1114 DF,  p-value: 7.545e-10
  1. Plot results from model_2.
ggplot(data = model_2, aes(x = pmdec, y = pmra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="pmra", x="pmdec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

ngc_6544 %>%
  ggplot(aes(pmdec,pmra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="pmra", x="pmdec") 
## Warning: Removed 884 rows containing missing values (geom_point).

Model 3

  1. Use lm() to regress phot_g_mean_mag on bp_rp and save the regression as model_3.
model_3 <- lm(phot_g_mean_mag ~ bp_rp, data = ngc_6544)
  1. Regression results from the third model using summary().

An increase of one unit of bp_rp is associated with an additional -0.02021 unit decrease in phot_g_mean_mag. This relationship is statistically significant at < 1.

summary(model_3)
## 
## Call:
## lm(formula = phot_g_mean_mag ~ bp_rp, data = ngc_6544)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.4813 -0.4299  0.2757  0.7987  2.3602 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 17.78717    0.17697 100.512   <2e-16 ***
## bp_rp       -0.02021    0.08514  -0.237    0.812    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.255 on 807 degrees of freedom
##   (1191 observations deleted due to missingness)
## Multiple R-squared:  6.981e-05,  Adjusted R-squared:  -0.001169 
## F-statistic: 0.05634 on 1 and 807 DF,  p-value: 0.8124
  1. Plot results from model_3.
ggplot(data = model_3, aes(x = bp_rp, y = phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="phot_g_mean_mag", x="bp_rp") +
  stat_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Graph

ngc_6544 %>%
  ggplot(aes(bp_rp,phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="phot_g_mean_mag", x="bp_rp")
## Warning: Removed 1191 rows containing missing values (geom_point).

Metallicity Over Hydrogen

ggplot(ngc_6544, aes(mh_gspphot)) +
  geom_histogram(bins = 30)
## Warning: Removed 1809 rows containing non-finite values (stat_bin).

Radio Velocity

ggplot(ngc_6544, aes(radial_velocity)) +
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1994 rows containing non-finite values (stat_bin).

Gaia DR3, NGC 6553

ngc_6553 <- read_csv("1657165215641O-result.csv")
## Rows: 2000 Columns: 26
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): phot_variable_flag
## dbl (18): source_id, ra, dec, parallax, pmra, pmdec, ruwe, phot_g_mean_mag, ...
## lgl  (7): has_xp_continuous, has_xp_sampled, has_rvs, has_epoch_photometry, ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Summary Statistics

summary(ngc_6553)
##    source_id               ra             dec            parallax      
##  Min.   :4.065e+18   Min.   :272.3   Min.   :-25.94   Min.   :-8.3416  
##  1st Qu.:4.065e+18   1st Qu.:272.3   1st Qu.:-25.93   1st Qu.:-0.0843  
##  Median :4.065e+18   Median :272.3   Median :-25.92   Median : 0.1786  
##  Mean   :4.065e+18   Mean   :272.3   Mean   :-25.92   Mean   : 0.2657  
##  3rd Qu.:4.065e+18   3rd Qu.:272.3   3rd Qu.:-25.91   3rd Qu.: 0.6172  
##  Max.   :4.065e+18   Max.   :272.4   Max.   :-25.89   Max.   : 8.1596  
##                                                       NA's   :1027     
##       pmra              pmdec               ruwe         phot_g_mean_mag
##  Min.   :-10.6486   Min.   :-13.6290   Min.   : 0.5672   Min.   :12.16  
##  1st Qu.: -1.6654   1st Qu.: -3.3308   1st Qu.: 1.1090   1st Qu.:16.83  
##  Median :  0.1145   Median : -0.7711   Median : 1.3851   Median :18.25  
##  Mean   : -0.5553   Mean   : -1.7958   Mean   : 1.7882   Mean   :17.82  
##  3rd Qu.:  0.7289   3rd Qu.: -0.1012   3rd Qu.: 1.9862   3rd Qu.:18.99  
##  Max.   :  8.9418   Max.   : 10.3322   Max.   :17.6072   Max.   :19.98  
##  NA's   :1027       NA's   :1027       NA's   :1027      NA's   :3      
##      bp_rp         radial_velocity     phot_variable_flag non_single_star
##  Min.   :-0.1685   Min.   :-141.1828   Length:2000        Min.   :0      
##  1st Qu.: 1.9018   1st Qu.:  -1.8062   Class :character   1st Qu.:0      
##  Median : 2.0406   Median :   0.6087   Mode  :character   Median :0      
##  Mean   : 2.0841   Mean   : -11.7559                      Mean   :0      
##  3rd Qu.: 2.2114   3rd Qu.:   8.9440                      3rd Qu.:0      
##  Max.   : 4.6823   Max.   :  21.6074                      Max.   :0      
##  NA's   :1181      NA's   :1991                                          
##  has_xp_continuous has_xp_sampled   has_rvs        has_epoch_photometry
##  Mode :logical     Mode :logical   Mode :logical   Mode :logical       
##  FALSE:1744        FALSE:1945      FALSE:1997      FALSE:1967          
##  TRUE :256         TRUE :55        TRUE :3         TRUE :33            
##                                                                        
##                                                                        
##                                                                        
##                                                                        
##  has_epoch_rv    has_mcmc_gspphot has_mcmc_msc     teff_gspphot  
##  Mode :logical   Mode :logical    Mode :logical   Min.   : 3543  
##  FALSE:2000      FALSE:1910       FALSE:1363      1st Qu.: 4762  
##                  TRUE :90         TRUE :637       Median : 4986  
##                                                   Mean   : 5299  
##                                                   3rd Qu.: 5256  
##                                                   Max.   :29741  
##                                                   NA's   :1870   
##   logg_gspphot      mh_gspphot      distance_gspphot azero_gspphot   
##  Min.   :0.0369   Min.   :-4.0553   Min.   :  416    Min.   :0.4017  
##  1st Qu.:2.8365   1st Qu.:-0.9629   1st Qu.:  974    1st Qu.:2.4291  
##  Median :3.3775   Median :-0.4138   Median : 1611    Median :3.0437  
##  Mean   :3.2869   Mean   :-0.6261   Mean   : 2064    Mean   :3.1867  
##  3rd Qu.:4.0656   3rd Qu.:-0.0277   3rd Qu.: 2141    3rd Qu.:3.8114  
##  Max.   :4.9183   Max.   : 0.7808   Max.   :10902    Max.   :9.7627  
##  NA's   :1870     NA's   :1870      NA's   :1870     NA's   :1870    
##    ag_gspphot     ebpminrp_gspphot
##  Min.   :0.3346   Min.   :0.1828  
##  1st Qu.:1.8167   1st Qu.:0.9804  
##  Median :2.1996   Median :1.1942  
##  Mean   :2.2988   Mean   :1.2650  
##  3rd Qu.:2.7175   3rd Qu.:1.4837  
##  Max.   :6.1531   Max.   :3.5492  
##  NA's   :1870     NA's   :1870

Model 4

  1. Use lm() to regress ra on dec and save the regression as model_4.
model_4 <- lm(ra ~ dec, data = ngc_6553)
  1. Regression results from the fourth model using summary().

An increase of one unit of dec is associated with an additional 0.64366 unit increase in ra. This relationship is statistically significant at < 0.001.

summary(model_4)
## 
## Call:
## lm(formula = ra ~ dec, data = ngc_6553)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0293835 -0.0080779 -0.0003821  0.0079258  0.0215398 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 289.01202    0.52899  546.34   <2e-16 ***
## dec           0.64366    0.02041   31.54   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01013 on 1998 degrees of freedom
## Multiple R-squared:  0.3324, Adjusted R-squared:  0.332 
## F-statistic: 994.6 on 1 and 1998 DF,  p-value: < 2.2e-16
  1. Plot results from model_4.
ggplot(data = model_4, aes(x = dec, y = ra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="ra", x="dec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

ngc_6553 %>%
  ggplot(aes(dec,ra)) +
  geom_point(alpha=0.5, size= 2, color = 'blue') +
  labs(y="ra", x="dec")

#### Model 5

  1. Use lm() to regress pmra on pmdec and save the regression as model_5.
model_5 <- lm(pmra ~ pmdec, data = ngc_6553)
  1. Regression results from the fifth model using summary().

An increase of one unit of pmdec is associated with an additional 0.46002 unit increase in pmra. This relationship is statistically significant at < 0.001.

summary(model_5)
## 
## Call:
## lm(formula = pmra ~ pmdec, data = ngc_6553)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -11.1661  -0.6839   0.1666   0.8702   9.5786 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.27083    0.08168   3.316 0.000948 ***
## pmdec        0.46002    0.02357  19.514  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.179 on 971 degrees of freedom
##   (1027 observations deleted due to missingness)
## Multiple R-squared:  0.2817, Adjusted R-squared:  0.2809 
## F-statistic: 380.8 on 1 and 971 DF,  p-value: < 2.2e-16

c.Plot results from model_5.

ggplot(data = model_5, aes(x = pmdec, y = pmra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="pmra", x="pmdec") +
  stat_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Graph

ngc_6553 %>%
  ggplot(aes(pmdec,pmra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="pmra", x="pmdec") 
## Warning: Removed 1027 rows containing missing values (geom_point).

Model 6

  1. Use lm() to regress pmra on pmdec and save the regression as model_6.
model_6 <- lm(phot_g_mean_mag ~ bp_rp, data = ngc_6553)
  1. Regression results from the fifth model using summary().

An increase of one unit of pmdec is associated with an additional -1.8339 unit decrease in pmra. This relationship is statistically significant at < 0.001.

summary(model_6)
## 
## Call:
## lm(formula = phot_g_mean_mag ~ bp_rp, data = ngc_6553)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.0832 -1.0476  0.0901  0.9477  3.8523 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  20.7853     0.2251   92.35   <2e-16 ***
## bp_rp        -1.8339     0.1059  -17.32   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.263 on 817 degrees of freedom
##   (1181 observations deleted due to missingness)
## Multiple R-squared:  0.2685, Adjusted R-squared:  0.2676 
## F-statistic: 299.9 on 1 and 817 DF,  p-value: < 2.2e-16
  1. Plot results from model_6.
ggplot(data = model_6, aes(x = bp_rp, y = phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="phot_g_mean_mag", x="bp_rp") +
  stat_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Graph

ngc_6553 %>%
  ggplot(aes(bp_rp,phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="phot_g_mean_mag", x="bp_rp")
## Warning: Removed 1181 rows containing missing values (geom_point).

Metallicity Over Hydrogen

ggplot(ngc_6553, aes(mh_gspphot)) +
  geom_histogram(bins = 30)
## Warning: Removed 1870 rows containing non-finite values (stat_bin).

Radio Velocity

ggplot(ngc_6553, aes(radial_velocity)) +
  geom_histogram(bins = 30)
## Warning: Removed 1991 rows containing non-finite values (stat_bin).

Gaia DR3, Terzan 12

terzan_12 <- read_csv("1657165792389O-result.csv")
## Rows: 1416 Columns: 26
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): phot_variable_flag
## dbl (18): source_id, ra, dec, parallax, pmra, pmdec, ruwe, phot_g_mean_mag, ...
## lgl  (7): has_xp_continuous, has_xp_sampled, has_rvs, has_epoch_photometry, ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Summary Statistics

summary(terzan_12)
##    source_id               ra             dec            parallax      
##  Min.   :4.067e+18   Min.   :273.0   Min.   :-22.78   Min.   :-7.4591  
##  1st Qu.:4.067e+18   1st Qu.:273.1   1st Qu.:-22.75   1st Qu.:-0.0605  
##  Median :4.067e+18   Median :273.1   Median :-22.74   Median : 0.2401  
##  Mean   :4.067e+18   Mean   :273.1   Mean   :-22.74   Mean   : 0.3113  
##  3rd Qu.:4.067e+18   3rd Qu.:273.1   3rd Qu.:-22.73   3rd Qu.: 0.6288  
##  Max.   :4.067e+18   Max.   :273.1   Max.   :-22.71   Max.   : 9.1725  
##                                                       NA's   :330      
##       pmra              pmdec              ruwe        phot_g_mean_mag
##  Min.   :-14.0406   Min.   :-16.476   Min.   :0.7628   Min.   :13.49  
##  1st Qu.: -6.1099   1st Qu.: -5.272   1st Qu.:1.0056   1st Qu.:18.77  
##  Median : -3.7502   Median : -3.277   Median :1.0593   Median :19.67  
##  Mean   : -3.2932   Mean   : -3.822   Mean   :1.0987   Mean   :19.43  
##  3rd Qu.: -0.7696   3rd Qu.: -2.516   3rd Qu.:1.1222   3rd Qu.:20.40  
##  Max.   : 13.0895   Max.   :  8.646   Max.   :7.9593   Max.   :21.31  
##  NA's   :330        NA's   :330       NA's   :330      NA's   :18     
##      bp_rp        radial_velocity   phot_variable_flag non_single_star
##  Min.   :-1.595   Min.   :-56.708   Length:1416        Min.   :0      
##  1st Qu.: 2.646   1st Qu.:-28.504   Class :character   1st Qu.:0      
##  Median : 3.212   Median :  4.224   Mode  :character   Median :0      
##  Mean   : 3.165   Mean   : 26.071                      Mean   :0      
##  3rd Qu.: 3.713   3rd Qu.: 90.723                      3rd Qu.:0      
##  Max.   : 6.977   Max.   :121.787                      Max.   :0      
##  NA's   :380      NA's   :1403                                        
##  has_xp_continuous has_xp_sampled   has_rvs        has_epoch_photometry
##  Mode :logical     Mode :logical   Mode :logical   Mode :logical       
##  FALSE:1306        FALSE:1405      FALSE:1416      FALSE:1394          
##  TRUE :110         TRUE :11                        TRUE :22            
##                                                                        
##                                                                        
##                                                                        
##                                                                        
##  has_epoch_rv    has_mcmc_gspphot has_mcmc_msc     teff_gspphot  
##  Mode :logical   Mode :logical    Mode :logical   Min.   : 3133  
##  FALSE:1416      FALSE:1198       FALSE:1230      1st Qu.: 3976  
##                  TRUE :218        TRUE :186       Median : 4528  
##                                                   Mean   : 4689  
##                                                   3rd Qu.: 4799  
##                                                   Max.   :15012  
##                                                   NA's   :1157   
##   logg_gspphot      mh_gspphot      distance_gspphot azero_gspphot    
##  Min.   :0.2009   Min.   :-3.7779   Min.   : 306.4   Min.   : 0.0498  
##  1st Qu.:3.2127   1st Qu.:-0.8198   1st Qu.: 512.4   1st Qu.: 5.1394  
##  Median :4.0442   Median :-0.3749   Median : 868.7   Median : 6.7906  
##  Mean   :3.5905   Mean   :-0.3844   Mean   :1107.3   Mean   : 6.2606  
##  3rd Qu.:4.1676   3rd Qu.: 0.2052   3rd Qu.:1175.7   3rd Qu.: 8.1680  
##  Max.   :4.7671   Max.   : 0.7830   Max.   :8928.4   Max.   : 9.9999  
##  NA's   :1157     NA's   :1157      NA's   :1157     NA's   :1157     
##    ag_gspphot     ebpminrp_gspphot
##  Min.   :0.0377   Min.   :0.0201  
##  1st Qu.:3.3614   1st Qu.:1.8909  
##  Median :4.3724   Median :2.4866  
##  Mean   :4.0440   Mean   :2.2990  
##  3rd Qu.:5.2477   3rd Qu.:2.9979  
##  Max.   :6.6393   Max.   :3.8421  
##  NA's   :1157     NA's   :1157

Model 7

  1. Use lm() to regress ra on dec and save the regression as model_7.
model_7 <- lm(ra ~ dec, data = terzan_12)
  1. Regression results from the first model using summary().

An increase of one unit of dec is associated with an additional 0.01603 unit increase in ra. This relationship is statistically significant at < 1.

summary(model_7)
## 
## Call:
## lm(formula = ra ~ dec, data = terzan_12)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.03239 -0.01213 -0.00112  0.01108  0.03927 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 273.42692    0.64806 421.918   <2e-16 ***
## dec           0.01603    0.02850   0.562    0.574    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01648 on 1414 degrees of freedom
## Multiple R-squared:  0.0002237,  Adjusted R-squared:  -0.0004834 
## F-statistic: 0.3164 on 1 and 1414 DF,  p-value: 0.5739
  1. Plot results from model_7.
ggplot(data = model_7, aes(x = dec, y = ra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="ra", x="dec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

terzan_12 %>%
  ggplot(aes(dec,ra)) +
  geom_point(alpha=0.5, size= 2, color = 'blue') +
  labs(y="ra", x="dec")

Model 8

  1. Use lm() to regress pmra on pmdec and save the regression as model_8.
model_8 <- lm(pmra ~ pmdec, data = terzan_12)
  1. Regression results from the second model using summary().

An increase of one unit of pmdec is associated with an additional 0.17153 unit increase in pmra. This relationship is statistically significant at < 0.001.

summary(model_8)
## 
## Call:
## lm(formula = pmra ~ pmdec, data = terzan_12)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -9.9358 -2.8916 -0.3413  2.4903 17.9565 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.63767    0.16686 -15.807  < 2e-16 ***
## pmdec        0.17153    0.03461   4.956 8.33e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.352 on 1084 degrees of freedom
##   (330 observations deleted due to missingness)
## Multiple R-squared:  0.02216,    Adjusted R-squared:  0.02126 
## F-statistic: 24.56 on 1 and 1084 DF,  p-value: 8.334e-07
  1. Plot results from model_8.
ggplot(data = model_8, aes(x = pmdec, y = pmra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="pmra", x="pmdec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

terzan_12 %>%
  ggplot(aes(pmdec,pmra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="pmra", x="pmdec") 
## Warning: Removed 330 rows containing missing values (geom_point).

Metallicity Over Hydrogen

ggplot(terzan_12, aes(mh_gspphot)) +
  geom_histogram(bins = 30)
## Warning: Removed 1157 rows containing non-finite values (stat_bin).

Radio Velocity

ggplot(terzan_12, aes(radial_velocity)) +
  geom_histogram(bins = 30)
## Warning: Removed 1403 rows containing non-finite values (stat_bin).

Gaia DR3, NGC 6380

ngc_6380 <- read_csv("1657166932125O-result.csv") 
## Rows: 2000 Columns: 26
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): phot_variable_flag
## dbl (18): source_id, ra, dec, parallax, pmra, pmdec, ruwe, phot_g_mean_mag, ...
## lgl  (7): has_xp_continuous, has_xp_sampled, has_rvs, has_epoch_photometry, ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Summary Statistics

summary(ngc_6380)
##    source_id               ra             dec            parallax       
##  Min.   :5.962e+18   Min.   :263.6   Min.   :-39.10   Min.   :-10.4104  
##  1st Qu.:5.962e+18   1st Qu.:263.6   1st Qu.:-39.08   1st Qu.: -0.2638  
##  Median :5.962e+18   Median :263.6   Median :-39.07   Median :  0.0929  
##  Mean   :5.962e+18   Mean   :263.6   Mean   :-39.08   Mean   :  0.0708  
##  3rd Qu.:5.962e+18   3rd Qu.:263.6   3rd Qu.:-39.07   3rd Qu.:  0.4979  
##  Max.   :5.962e+18   Max.   :263.7   Max.   :-39.05   Max.   :  9.7858  
##                                                       NA's   :785       
##       pmra             pmdec              ruwe        phot_g_mean_mag 
##  Min.   :-16.750   Min.   :-17.015   Min.   :0.7097   Min.   : 9.705  
##  1st Qu.: -2.776   1st Qu.: -4.196   1st Qu.:1.0160   1st Qu.:18.206  
##  Median : -2.127   Median : -3.345   Median :1.0820   Median :19.232  
##  Mean   : -1.929   Mean   : -3.492   Mean   :1.2662   Mean   :19.055  
##  3rd Qu.: -1.087   3rd Qu.: -2.739   3rd Qu.:1.2366   3rd Qu.:20.150  
##  Max.   : 14.119   Max.   :  6.418   Max.   :9.3613   Max.   :21.159  
##  NA's   :785       NA's   :785       NA's   :785      NA's   :5       
##      bp_rp        radial_velocity    phot_variable_flag non_single_star
##  Min.   :-1.396   Min.   :-208.995   Length:2000        Min.   :0      
##  1st Qu.: 2.259   1st Qu.:  -4.916   Class :character   1st Qu.:0      
##  Median : 2.590   Median :   5.294   Mode  :character   Median :0      
##  Mean   : 2.510   Mean   : -12.601                      Mean   :0      
##  3rd Qu.: 2.769   3rd Qu.:  13.563                      3rd Qu.:0      
##  Max.   : 5.867   Max.   :  51.103                      Max.   :0      
##  NA's   :972      NA's   :1982                                         
##  has_xp_continuous has_xp_sampled   has_rvs        has_epoch_photometry
##  Mode :logical     Mode :logical   Mode :logical   Mode :logical       
##  FALSE:1834        FALSE:1982      FALSE:1999      FALSE:1959          
##  TRUE :166         TRUE :18        TRUE :1         TRUE :41            
##                                                                        
##                                                                        
##                                                                        
##                                                                        
##  has_epoch_rv    has_mcmc_gspphot has_mcmc_msc     teff_gspphot  
##  Mode :logical   Mode :logical    Mode :logical   Min.   : 3417  
##  FALSE:2000      FALSE:1790       FALSE:1585      1st Qu.: 3893  
##                  TRUE :210        TRUE :415       Median : 4300  
##                                                   Mean   : 4738  
##                                                   3rd Qu.: 4789  
##                                                   Max.   :15017  
##                                                   NA's   :1755   
##   logg_gspphot      mh_gspphot      distance_gspphot azero_gspphot   
##  Min.   :0.4522   Min.   :-3.1950   Min.   : 330.3   Min.   :0.0159  
##  1st Qu.:4.0714   1st Qu.:-1.3783   1st Qu.: 566.5   1st Qu.:2.2810  
##  Median :4.2419   Median :-1.0010   Median : 677.6   Median :3.1939  
##  Mean   :4.0669   Mean   :-0.9318   Mean   : 977.2   Mean   :3.3982  
##  3rd Qu.:4.4333   3rd Qu.:-0.5022   3rd Qu.:1048.5   3rd Qu.:4.3835  
##  Max.   :4.9295   Max.   : 0.7855   Max.   :7690.7   Max.   :9.9591  
##  NA's   :1755     NA's   :1755      NA's   :1755     NA's   :1755    
##    ag_gspphot     ebpminrp_gspphot
##  Min.   :0.0111   Min.   :0.0060  
##  1st Qu.:1.6090   1st Qu.:0.8926  
##  Median :2.2064   Median :1.2149  
##  Mean   :2.3579   Mean   :1.3079  
##  3rd Qu.:3.0044   3rd Qu.:1.6493  
##  Max.   :6.0713   Max.   :3.4802  
##  NA's   :1755     NA's   :1755

Model 9

  1. Use lm() to regress ra on dec and save the regression as model_9.
model_9 <- lm(ra ~ dec, data = ngc_6380)
  1. Regression results from the first model using summary().

An increase of one unit of dec is associated with an additional 0.35053 unit increase in ra. This relationship is statistically significant at < 0.001.

summary(model_9)
## 
## Call:
## lm(formula = ra ~ dec, data = ngc_6380)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.043668 -0.010389 -0.001172  0.011399  0.037492 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 277.31808    1.34662  205.94   <2e-16 ***
## dec           0.35053    0.03446   10.17   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01671 on 1998 degrees of freedom
## Multiple R-squared:  0.04923,    Adjusted R-squared:  0.04876 
## F-statistic: 103.5 on 1 and 1998 DF,  p-value: < 2.2e-16
  1. Plot results from model_9.
ggplot(data = model_9, aes(x = dec, y = ra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="ra", x="dec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

ngc_6380 %>%
  ggplot(aes(dec,ra)) +
  geom_point(alpha=0.5, size= 2, color = 'blue') +
  labs(y="ra", x="dec")

Model 10

  1. Use lm() to regress pmra on pmdec and save the regression as model_10.
model_10 <- lm(pmra ~ pmdec, data = ngc_6380)
  1. Regression results from the second model using summary().

An increase of one unit of pmdec is associated with an additional 0.17272 unit increase in pmra. This relationship is statistically significant at < 0.001.

summary(model_10)
## 
## Call:
## lm(formula = pmra ~ pmdec, data = ngc_6380)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -15.0337  -0.9047  -0.2010   0.8336  15.0940 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.32546    0.12673 -10.459  < 2e-16 ***
## pmdec        0.17272    0.03098   5.576 3.03e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.302 on 1213 degrees of freedom
##   (785 observations deleted due to missingness)
## Multiple R-squared:  0.02499,    Adjusted R-squared:  0.02419 
## F-statistic: 31.09 on 1 and 1213 DF,  p-value: 3.034e-08
  1. Plot results from model_10.
ggplot(data = model_10, aes(x = pmdec, y = pmra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="pmra", x="pmdec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

ngc_6380 %>%
  ggplot(aes(pmdec,pmra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="pmra", x="pmdec") 
## Warning: Removed 785 rows containing missing values (geom_point).

Model 11

  1. Use lm() to regress phot_g_mean_mag on bp_rp and save the regression as model_11.
model_11 <- lm(phot_g_mean_mag ~ bp_rp, data = ngc_6380)
  1. Regression results from the third model using summary().

An increase of one unit of bp_rp is associated with an additional -1.02741 unit decrease in phot_g_mean_mag. This relationship is statistically significant at < 0.001.

summary(model_11)
## 
## Call:
## lm(formula = phot_g_mean_mag ~ bp_rp, data = ngc_6380)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -11.0059  -0.6643  -0.0116   0.9888   3.5449 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 21.18548    0.22031   96.16   <2e-16 ***
## bp_rp       -1.02741    0.08615  -11.93   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.356 on 1026 degrees of freedom
##   (972 observations deleted due to missingness)
## Multiple R-squared:  0.1217, Adjusted R-squared:  0.1209 
## F-statistic: 142.2 on 1 and 1026 DF,  p-value: < 2.2e-16
  1. Plot results from model_11.
ggplot(data = model_11, aes(x = bp_rp, y = phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="phot_g_mean_mag", x="bp_rp") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

ngc_6380 %>%
  ggplot(aes(bp_rp,phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="phot_g_mean_mag", x="bp_rp")
## Warning: Removed 972 rows containing missing values (geom_point).

Metallicity Over Hydrogen

ggplot(ngc_6380, aes(mh_gspphot)) +
  geom_histogram(bins = 30)
## Warning: Removed 1755 rows containing non-finite values (stat_bin).

Radio Velocity

ggplot(ngc_6380, aes(radial_velocity)) +
  geom_histogram(bins = 30)
## Warning: Removed 1982 rows containing non-finite values (stat_bin).

Gaia DR3, FSR 1758

fsr_1758 <- read.csv("1657248340808O-result.csv")

Summary Statistics

summary(fsr_1758)
##    source_id               ra             dec            parallax       
##  Min.   :5.962e+18   Min.   :262.8   Min.   :-39.86   Min.   :-12.0892  
##  1st Qu.:5.962e+18   1st Qu.:262.8   1st Qu.:-39.84   1st Qu.: -0.2286  
##  Median :5.962e+18   Median :262.8   Median :-39.83   Median :  0.1495  
##  Mean   :5.962e+18   Mean   :262.8   Mean   :-39.83   Mean   :  0.2072  
##  3rd Qu.:5.962e+18   3rd Qu.:262.8   3rd Qu.:-39.82   3rd Qu.:  0.6315  
##  Max.   :5.962e+18   Max.   :262.8   Max.   :-39.80   Max.   : 10.7769  
##                                                       NA's   :990       
##       pmra              pmdec              ruwe         phot_g_mean_mag
##  Min.   :-19.8029   Min.   :-20.186   Min.   : 0.7775   Min.   :13.19  
##  1st Qu.: -3.6099   1st Qu.: -5.225   1st Qu.: 1.0009   1st Qu.:18.82  
##  Median : -2.5601   Median : -2.874   Median : 1.0634   Median :19.87  
##  Mean   : -2.2823   Mean   : -2.319   Mean   : 1.2112   Mean   :19.40  
##  3rd Qu.: -0.6576   3rd Qu.:  1.918   3rd Qu.: 1.1871   3rd Qu.:20.31  
##  Max.   : 19.9996   Max.   :  8.181   Max.   :15.3358   Max.   :21.06  
##  NA's   :990        NA's   :990       NA's   :990       NA's   :10     
##      bp_rp        radial_velocity    phot_variable_flag non_single_star
##  Min.   :-1.160   Min.   :-220.418   Length:2000        Min.   :0      
##  1st Qu.: 1.628   1st Qu.: -34.066   Class :character   1st Qu.:0      
##  Median : 1.868   Median :  -6.326   Mode  :character   Median :0      
##  Mean   : 1.836   Mean   :  48.350                      Mean   :0      
##  3rd Qu.: 2.059   3rd Qu.: 217.536                      3rd Qu.:0      
##  Max.   : 4.722   Max.   : 230.887                      Max.   :0      
##  NA's   :970      NA's   :1981                                         
##  has_xp_continuous  has_xp_sampled       has_rvs          has_epoch_photometry
##  Length:2000        Length:2000        Length:2000        Length:2000         
##  Class :character   Class :character   Class :character   Class :character    
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character    
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##  has_epoch_rv       has_mcmc_gspphot   has_mcmc_msc        teff_gspphot  
##  Length:2000        Length:2000        Length:2000        Min.   : 3275  
##  Class :character   Class :character   Class :character   1st Qu.: 3934  
##  Mode  :character   Mode  :character   Mode  :character   Median : 4431  
##                                                           Mean   : 4616  
##                                                           3rd Qu.: 4923  
##                                                           Max.   :15013  
##                                                           NA's   :1717   
##   logg_gspphot     mh_gspphot      distance_gspphot azero_gspphot   
##  Min.   :1.628   Min.   :-4.1148   Min.   : 351.1   Min.   :0.0008  
##  1st Qu.:4.180   1st Qu.:-1.5883   1st Qu.: 615.8   1st Qu.:0.4348  
##  Median :4.521   Median :-1.1630   Median : 751.2   Median :1.2773  
##  Mean   :4.338   Mean   :-1.1496   Mean   :1119.6   Mean   :1.4542  
##  3rd Qu.:4.811   3rd Qu.:-0.5429   3rd Qu.:1374.4   3rd Qu.:2.2539  
##  Max.   :5.055   Max.   : 0.7718   Max.   :9314.1   Max.   :5.1196  
##  NA's   :1717    NA's   :1717      NA's   :1717     NA's   :1717    
##    ag_gspphot     ebpminrp_gspphot
##  Min.   :0.0007   Min.   :0.0004  
##  1st Qu.:0.3161   1st Qu.:0.1708  
##  Median :0.9321   Median :0.5068  
##  Mean   :1.0716   Mean   :0.5831  
##  3rd Qu.:1.6457   3rd Qu.:0.8967  
##  Max.   :4.2022   Max.   :2.3293  
##  NA's   :1717     NA's   :1717

Model 12

  1. Use lm() to regress ra on dec and save the regression as model_12.
model_12 <- lm(ra ~ dec, data = fsr_1758)
  1. Regression results from the first model using summary().

An increase of one unit of dec is associated with an additional 0.59648 unit increase in ra. This relationship is statistically significant at < 0.001.

summary(model_12)
## 
## Call:
## lm(formula = ra ~ dec, data = fsr_1758)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.055624 -0.009150  0.004288  0.015665  0.033606 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 286.57239    1.47722  193.99   <2e-16 ***
## dec           0.59648    0.03709   16.08   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02136 on 1998 degrees of freedom
## Multiple R-squared:  0.1146, Adjusted R-squared:  0.1142 
## F-statistic: 258.6 on 1 and 1998 DF,  p-value: < 2.2e-16
  1. Plot results from model_12.
ggplot(data = model_12, aes(x = dec, y = ra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="ra", x="dec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

fsr_1758 %>%
  ggplot(aes(dec,ra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="ra", x="dec")

Model 13

  1. Use lm() to regress pmra on pmdec and save the regression as model_13.
model_13 <- lm(pmra ~ pmdec, data = fsr_1758)
  1. Regression results from the second model using summary().

An increase of one unit of pmdec is associated with an additional 0.04283 unit increase in pmra. This relationship is statistically significant at < 0.1.

summary(model_13)
## 
## Call:
## lm(formula = pmra ~ pmdec, data = fsr_1758)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -17.0701  -1.3090  -0.3629   1.5897  22.7883 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.18301    0.11378 -19.187   <2e-16 ***
## pmdec        0.04283    0.02417   1.772   0.0766 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.147 on 1008 degrees of freedom
##   (990 observations deleted due to missingness)
## Multiple R-squared:  0.003107,   Adjusted R-squared:  0.002118 
## F-statistic: 3.141 on 1 and 1008 DF,  p-value: 0.07663
  1. Plot results from model_13.
ggplot(data = model_13, aes(x = pmdec, y = pmra)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="pmra", x="pmdec") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

fsr_1758 %>%
  ggplot(aes(pmdec,pmra)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="pmra", x="pmdec") 
## Warning: Removed 990 rows containing missing values (geom_point).

Model 14

  1. Use lm() to regress phot_g_mean_mag on bp_rp and save the regression as model_14.
model_14 <- lm(phot_g_mean_mag ~ bp_rp, data = fsr_1758)
  1. Regression results from the third model using summary().

An increase of one unit of bp_rp is associated with an additional -0.44855 unit decrease in phot_g_mean_mag. This relationship is statistically significant at < 0.001.

summary(model_14)
## 
## Call:
## lm(formula = phot_g_mean_mag ~ bp_rp, data = fsr_1758)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.0683 -0.8107  0.2927  1.0721  2.9958 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 19.59730    0.17930  109.30  < 2e-16 ***
## bp_rp       -0.44855    0.09484   -4.73 2.56e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.373 on 1028 degrees of freedom
##   (970 observations deleted due to missingness)
## Multiple R-squared:  0.0213, Adjusted R-squared:  0.02034 
## F-statistic: 22.37 on 1 and 1028 DF,  p-value: 2.565e-06
  1. Plot results from model_14.
ggplot(data = model_14, aes(x = bp_rp, y = phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'orange') +
  labs(y="phot_g_mean_mag", x="bp_rp") +
  stat_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Graph

fsr_1758 %>%
  ggplot(aes(bp_rp,phot_g_mean_mag)) +
  geom_point(alpha=0.5, size=2, color = 'blue') +
  labs(y="phot_g_mean_mag", x="bp_rp")
## Warning: Removed 970 rows containing missing values (geom_point).

Metallicity Over Hydrogen

ggplot(fsr_1758, aes(mh_gspphot)) +
  geom_histogram(bins = 30)
## Warning: Removed 1717 rows containing non-finite values (stat_bin).

Radio Velocity

ggplot(fsr_1758, aes(radial_velocity)) + 
  geom_histogram(bins = 30)
## Warning: Removed 1981 rows containing non-finite values (stat_bin).

```